/* Check email in database */
function checkEmail()
{
	var em = document.forms['recovery'].elements['email'].value;
	var url = './login?app=checkem&em=' + encodeURIComponent(em);

	new Ajax.Request(url, {
		method: 'get',
		onSuccess: function(http) {
			if ( parseInt(http.responseText) == 0 ) {
				$('email').update('<img src="./images/error.png" alt="" /> Invalid email');
				document.forms['recovery'].disabled = true;
				$('recover').disabled = true;
			} else {
				$('email').update('<img src="./images/ok.png" alt="" />');
				document.forms['recovery'].disabled = false;
				$('recover').disabled = false;
			}
		}
	} );
}